package cn.wjee.gradle.flink.task;

import cn.wjee.gradle.flink.api.FlinkSubmitterApi;
import cn.wjee.gradle.flink.config.FlinkExtConfig;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.TaskAction;

import javax.inject.Inject;

/**
 * Publish Flink Job Task
 *
 * @author listening
 */
public class PublishFlinkTask extends DefaultTask {
    private final FlinkExtConfig config;

    @Inject
    public PublishFlinkTask(FlinkExtConfig config) {
        this.config = config;
    }

    @TaskAction
    public void run() {
        FlinkSubmitterApi.submitJob(config);
    }
}
